<!DOCTYPE html>
<html>

  {{ partial "head.html" . }}

  <body>

    <div>

        <header>

          {{ partial "nav.html" . }}

        </header>

        <div id="content">
            <div class="container">
                <div class="post-feed">

                    {{ $Paginator := .Paginate (where .Data.Pages.ByDate.Reverse "Type" "news") 4 }}
                    {{ range $Paginator.Pages }}
                    
                    <article class="post-card post"> 
                        {{if .Params.image}}
                        <a class="post-card-image-link" href="{{ .Permalink }}">
                            <div class="post-card-image" style="background-image: url({{.Params.image | absURL}})"></div>
                        </a>
                        {{end}}
                    
                        <div class="post-card-content">
                            <a class="post-card-content-link" href="{{ .Permalink }}">
                                <header class="post-card-header">
                                    {{if .Params.tags }}<span class="post-card-tags">{{ range $index, $tag := .Params.tags }}
                                    #{{$tag}} {{end}} </span>
                                    {{ end }}
                                    <h2 class="post-card-title">{{.Title}}</h2>
                                </header>
                                <section class="post-card-excerpt">
                                    {{ if .Description }} 
                                    <p>{{ .Description | markdownify }}</p>
                                    {{else}}
                                    <p>{{ .Summary | plainify | safeHTML }}{{ if .Truncated }} ... {{end}} </p>
                                    {{end}}
                                </section>
                            </a>

                        </div>
                    </article>
                    {{ end }}

                </div>
                <!-- /.post-feed -->

                <ul>
                        {{ if .Paginator.HasPrev }}
                        <li class="previous"><a href="{{ .Site.BaseURL }}{{ .Paginator.Prev.URL }}">&larr; {{ i18n "newer" }}</a></li>
                        {{ else }}
                        <li class="previous disabled"><a href="#">&larr; {{ i18n "newer" }}</a></li>
                        {{ end }}

                        {{ if .Paginator.HasNext }}
                        <li class="next"><a href="{{ .Site.BaseURL }}{{ .Paginator.Next.URL }}">{{ i18n "older" }} &rarr;</a></li>
                        {{ else }}
                        <li class="next disabled"><a href="#">{{ i18n "older" }} &rarr;</a></li>
                        {{ end }}
                </ul>
            </div>
            <!-- /.container -->
        </div>
        <!-- /#content -->

        {{ partial "footer.html" . }}

    </div>
    <!-- /#all -->

    {{ partial "scripts.html" . }}

  </body>
</html>
